﻿<s:ScatterViewItem x:Class="ENMAX_ArcGIS.MapFrame" 
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:s="http://schemas.microsoft.com/surface/2008"
                   xmlns:src="clr-namespace:ENMAX_ArcGIS"
                   Background="Transparent" AllowDrop="True" Height="270" Width="270" 
                   MinWidth="270" MinHeight="270"
                   SizeChanged="ScatterViewItem_SizeChanged" ZIndex="1"
                   RenderTransformOrigin="0.5,0.5" ClipToBounds="True"
                   CanMove="True" CanRotate="True" CanScale="True">                   

    
    <Grid Name="MapGrid">
        <!-- Row and column definitions to position content and buttons -->
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition/>
            <ColumnDefinition Width="30"/>
        </Grid.ColumnDefinitions>
        
        
        <!--<src:ArcGisMap x:Name="MainMap" Background="Transparent" 
                       ContactDown="MainMap_ContactDown" 
                       LostContactCapture="MainMap_LostContactCapture" 
                       ContactTapGesture="MainMap_ContactTapGesture" 
                       PreviewContactChanged="MainMap_PreviewContactChanged" 
                       Grid.ColumnSpan="11" Grid.RowSpan="3" Margin="0.012,0.012,0,0" />-->

        <!-- Annotations Demo Version - The Map and the ink Canvas-->
        <Grid Grid.ColumnSpan="11" Grid.RowSpan="5" x:Name="MainMapGrid" ClipToBounds="True" Margin="0.012,0.012,0,0">
            <src:ArcGisMap x:Name="MainMap" Background="Transparent" 
                       ContactDown="MainMap_ContactDown" 
                       LostContactCapture="MainMap_LostContactCapture" 
                       ContactTapGesture="MainMap_ContactTapGesture" 
                       PreviewContactChanged="MainMap_PreviewContactChanged"/>
            
            <Viewbox StretchDirection="Both" Stretch="Fill">
                <s:SurfaceInkCanvas x:Name="DrawingPadCanvas" 
                                            IsHitTestVisible="False" 
                                            UsesContactShape="False"                                              
                                            Background="Transparent"/>
            </Viewbox>
            
           
        </Grid>

        <!-- Glass Picture Frame Effect -->
        <Grid Name="glassFrame1" Background="WhiteSmoke" Opacity="0.5" Grid.ColumnSpan="11" />         
        <Grid Name="glassFrame2" Background="WhiteSmoke" Opacity="0.5" Grid.Row="1" Grid.RowSpan="3"/>
        <Grid Name="glassFrame3" Background="WhiteSmoke" Opacity="0.5" Grid.ColumnSpan="11" Grid.Row="4" />
        <Grid Name="glassFrame4" Background="WhiteSmoke" Opacity="0.5" Grid.Row="1" Grid.Column="10" Grid.RowSpan="3"/>
        
        <TextBlock Name="MapFrameTitle" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
                   TextAlignment="Center" FontSize="14" />
        <!-- The Map and the ink Canvas-->
        <!--<Grid Grid.Column="5" Grid.Row="1" x:Name="MainMapGrid" ClipToBounds="True" Margin="15,97"></Grid>-->
        
                
        <!--Archive/Close Button-->
        <s:SurfaceButton Grid.Row="0" Grid.Column="5" Padding="5" Background="White" Click="SaveButton_Click">
            <Image Source="Resources\Buttons\Delete.png"/>
        </s:SurfaceButton>

        <!-- Map Type Button -->
        <s:SurfaceButton Name="MapTypeButton" Grid.Row="0" Grid.Column="4" 
                         Padding="5" Background="White" Click="ToggleMapTypeClicked"
                         ToolTip="Switch to Google Earth">
            <Image Source="Resources\Buttons\Earth.png" />
        </s:SurfaceButton>

        <!-- Refresh Map Button -->
        <s:SurfaceButton Name="RefreshMapButton" Grid.Row="0" Grid.Column="6" 
                         Padding="5" Background="White" Click="RefreshMapClicked" ToolTip="Refresh">
            <Image Source="Resources\Buttons\Refresh.png" />
        </s:SurfaceButton>
        
        
        <!-- Draw Point Button -->
        <s:SurfaceButton Name="DrawPointButton" Grid.Row="4" Grid.Column="2" 
                         Padding="5" Background="White" Click="DrawPointButton_Click"
                         ToolTip="Add a point">
            <Image Source="Resources\Buttons\ESRI_Stuff\DrawPoint.png" />
        </s:SurfaceButton>

        
        <!-- Draw a Polyline Button -->
        <s:SurfaceButton Name="DrawPolylineButton" Grid.Row="4" Grid.Column="3" 
                         Padding="5" Background="White" Click="DrawPolylineButton_Click"
                         ToolTip="Add a Polyline">
            <Image Source="Resources\Buttons\ESRI_Stuff\DrawPolyline.png" />
        </s:SurfaceButton>

        <!-- Draw a Polygon Button -->
        <s:SurfaceButton Name="DrawPolygonButton" Grid.Row="4" Grid.Column="4" 
                         Padding="5" Background="White" Click="DrawPolygonButton_Click"
                         ToolTip="Add a Polygon">
            <Image Source="Resources\Buttons\ESRI_Stuff\DrawPolygon.png" />
        </s:SurfaceButton>

        <!-- Draw a Rectangle Button -->
        <s:SurfaceButton Name="DrawRectangleButton" Grid.Row="4" Grid.Column="5" 
                         Padding="5" Background="White" Click="DrawRectangleButton_Click"
                         ToolTip="Add a Rectangle">
            <Image Source="Resources\Buttons\ESRI_Stuff\DrawRectangle.png" />
        </s:SurfaceButton>

        <!-- Annotations Demo version-->
        <s:SurfaceButton Name="DrawFreehandButton" Grid.Row="4" Grid.Column="6" 
                         Padding="5" Click="InkCanvasOnOffChanged" Background="White"
                         ToolTip="Add Freehand">
            <Image Source="Resources\Buttons\ESRI_Stuff\DrawFreehand.png" />
        </s:SurfaceButton>
        
        <!-- Draw Freehand Button -->
        <!--<s:SurfaceButton Name="DrawFreehandButton" Grid.Row="2" Grid.Column="6" 
                         Padding="5" Background="White" Click="DrawFreehandButton_Click"
                         ToolTip="Add Freehand">
            <Image Source="Resources\Buttons\ESRI_Stuff\DrawFreehand.png" />
        </s:SurfaceButton>-->

        <!-- Stop Draw Button -->
        <!--<s:SurfaceButton Name="StopDrawButton" Grid.Row="2" Grid.Column="7" 
                         Padding="5" Background="White" Click="StopDrawButton_Click"
                         ToolTip="Stop Drawing">
            <Image Source="Resources\Buttons\ESRI_Stuff\StopDraw.png" />
        </s:SurfaceButton>-->

        <!-- Clear Graphics Button -->
        <s:SurfaceButton Name="ClearGraphicsButton" Grid.Row="4" Grid.Column="8" 
                         Padding="5" Background="White" Click="ClearGraphicsButton_Click"
                         ToolTip="Clear Graphics">
            <Image Source="Resources\Buttons\ESRI_Stuff\ClearGraphics.png"/>
        </s:SurfaceButton>
        
 
        <!-- Annotations Demo Version -->
        <Ellipse Name="CurrentColor" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                 Grid.Row="4" Grid.Column="7" Fill="Black"
                 s:Contacts.ContactTapGesture="OnCurrentColorTap"
                 s:Contacts.PreviewContactDown="OnColorSelectionPreviewContactDown"
                 ToolTip="Choose Color"/>

        <!-- Color Wheel -->
        <Image Name="ColorWheel" Grid.Row="2" Grid.Column="5" Source="Resources\Buttons\ColorWheel.png" RenderTransformOrigin="0.5, 0.5" 
                   Visibility="Hidden" s:Contacts.ContactTapGesture="OnColorWheelContactTap"
                   s:Contacts.PreviewContactDown="OnColorSelectionPreviewContactDown">
            <Image.RenderTransform>
                <ScaleTransform ScaleX="4" ScaleY="4" />
            </Image.RenderTransform>
        </Image>
        
    </Grid>

</s:ScatterViewItem>